using System;
using System.Collections.Generic;
using System.Text;

namespace GURUCORE.Portal.Core
{
	
	[AttributeUsage(AttributeTargets.Field)]
	public class PageletInParamAttribute : Attribute
	{
        // CONSTANT
        public const int URL_PARAM_SOURCE = 0;
        public const int SESSION_PARAM_SOURCE = 1;
        // public const int PAGE_CONTEXT_PARAM_SOURCE = 2;  // page context is use as internal storage for inter-exchange between pagelet IN A SINGLE REQUEST, not request to request, so it can't be here
		public const int PAGE_CONFIGURATION_PARAM_SOURCE = 3;

        #region PUBLIC PROPERTIES
        
        private int m_nParamSource = 0;
		private string m_sParamName;
		private bool m_bIsPreserved;
		private bool m_bIsShared;
		private object m_oDefault;		

		
		public int ParamSource
		{
			get
			{
				return m_nParamSource;
			}
		}

		public string ParamName
		{
			get
			{
				return m_sParamName;
			}
			set
			{
				m_sParamName = value;
			}
		}

		public bool IsPreserved
		{
			get
			{
				return m_bIsPreserved;
			}
			set
			{
				m_bIsPreserved = value;
			}
		}

		public bool IsShared
		{
			get
			{
				return m_bIsShared;
			}
			set
			{
				m_bIsShared = value;
			}
		}

		public object Default
		{
			get
			{
				return m_oDefault;
			}
			set
			{
				m_oDefault = value;
			}
        }

        #endregion  PUBLIC PROPERTIES



        public PageletInParamAttribute(string p_sParamName, int p_nParamSource)
            : this(p_nParamSource, p_sParamName, false, true)
        {
        }

        public PageletInParamAttribute(int p_nParamSource, string p_sParamName, bool p_bIsPreserved, bool p_bIsShared)
        {
            m_nParamSource = p_nParamSource;
            m_sParamName = p_sParamName;
            m_bIsPreserved = p_bIsPreserved;
            m_bIsShared = p_bIsShared;
        }

        public PageletInParamAttribute(int p_nParamSource, string p_sParamName, bool p_bIsPreserved, bool p_bIsShared, object p_oDefault)
        {
            m_nParamSource = p_nParamSource;
            m_sParamName = p_sParamName;
            m_bIsPreserved = p_bIsPreserved;
            m_bIsShared = p_bIsShared;
            m_oDefault = p_oDefault;
        }


	}   // end class
}   // end namespace
